package leetcode_1901_2000;

import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;

public class LeeCode_1909 {
    public static void main(String[] args) {
//        System.out.println(canBeIncreasing(new int[]{2, 3, 1, 2}));
        System.out.println(canBeIncreasing(new int[]{2,3,4,5,1,5}));
        System.out.println(canBeIncreasing(new int[]{100, 21, 100}));
        System.out.println(canBeIncreasing(new int[]{1,1}));
    }
    private static boolean canBeIncreasing(int[] nums) {
        int n = nums.length;
        int pre = -1;
        int del = -1;
        for (int i = 0; i < n - 1; i++) {
            if (nums[i] >= nums[i + 1]){
                if (nums[i + 1] > pre){
                    del = i;
                    break;
                }else {
                    del = i + 1;
                    break;
                }
            }
            pre = nums[i];
        }
        if (del == -1)
            return true;
        pre = -1;
        for (int i = 0; i < nums.length; i++) {
            if (i == del)
                continue;
            if (nums[i] <= pre){
                return false;
            }
            pre = nums[i];
        }
        return true;
    }
}
